﻿using A.M.ETO;
using AutoMapper;
using DotNetCore.CAP;
using J.M.Inventory.Application.IInventoryServices;
using J.M.Inventory.Domain.DTO;
using J.M.Inventory.Domain.Entity;
using J.M.Inventory.Infrastruecure.InventoryRepository;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Linq.Expressions;

namespace J.M.Inventory.Read.API.Controllers
{
    /// <summary>
    /// 出库管理表
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class EnterwarehouesReadController : ControllerBase
    {
        private readonly IEnterwarehouesServices  enterwarehouesServices;

        public EnterwarehouesReadController(IEnterwarehouesServices enterwarehouesServices)
        {
            this.enterwarehouesServices = enterwarehouesServices;
        }
        /// <summary>
        /// 显示销售订单
        /// </summary>
        /// <param name="code"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public IActionResult GetEnterShow(string? code, int pageIndex, int pageSize)
        {
            return Ok(enterwarehouesServices.GetEnterShow(code, pageIndex, pageSize));
        }
        /// <summary>
        /// 添加销售订单
        /// </summary>
        /// <param name="listenterwarehouesDTO"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public async Task<ApiReturn<string>> GetSEnterAddInfo(enterwarehouesAddDTO enterwarehouesAddDTO)
        { 
            return await enterwarehouesServices.GetSEnterAddInfo(enterwarehouesAddDTO);
        }
        /// <summary>
        /// 删除销售订单列表
        /// </summary>
        /// <param name="enterid"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpDelete]
        public int DeleteEnter(string? enterid)
        { 
            return enterwarehouesServices.DeleteEnter(enterid);
        }
        /// <summary>
        /// 反填销售订单
        /// </summary>
        /// <param name="enterid"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<enterwarehoues> FindEnterInfo(string? enterid)
        { 
            return await enterwarehouesServices.FindEnterInfo(enterid);
        }
        /// <summary>
        /// 查看仓库
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<ApiReturn<warehouse>> GetShowwarehouse()
        { 
            return await enterwarehouesServices.GetShowwarehouse();
        }
        /// <summary>
        /// 修改销售订单列表
        /// </summary>
        /// <param name="enterwarehouesAddDTO"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public async Task<ApiReturn<string>> PostEnterUpdateInfo(enterwarehouesAddDTO enterwarehouesAddDTO)
        {
            return await enterwarehouesServices.PostEnterUpdateInfo(enterwarehouesAddDTO);
        }

    }
}
